import request from '@/utils/request.js'
// 退出
function logout(){
	return new Promise((resolve,reject)=>{
		request.post('/member/index_login.php',{dopost:'exit'})
		.then(res=>resolve(res))
		.catch(err=>reject(err))
	})
}
// 获取用户信息
function getUserInfo(){
	return new Promise((resolve,reject)=>{
		request.get('/member/ajax_login.php')
		.then(res=>resolve(res))
		.catch(err=>reject(err))
	})
}
// 注册
function register(data,config={}){
	return new Promise((resolve,reject)=>{
		request.post("/member/reg_new2.php",data,config)
		.then(res=>resolve(res))
		.catch(err=>reject(err))
	})
}
// 登录
function login(data,config={}){
	return new Promise((resolve,reject)=>{
		request.post('/member/index_login.php',data,config)
		.then(res=>resolve(res))
		.catch(err=>reject(err))
	})
}
// 获取到期代发数据方法
function getDateSend(){
	return new Promise((resolve,reject)=>{
		request.get("/list/datesend")
		.then(res=>resolve(res))
		.catch(err=>reject(err))
	})
}
// 获取receipt表格数据方法
function getTableData(){
	return new Promise((resolve,reject)=>{
		request.get("/list/tabledata")
		.then(res=>resolve(res))
		.catch(err=>reject(err))
	})
}
// 导出退出方法
export{logout,getUserInfo,login,getDateSend,getTableData,register};